<!DOCTYPE html>
<html>
<head>
    <title> {$site_info.site_name|default=''}</title>
    <meta name="keywords" content="{$site_info.site_seo_keywords|default=''}"/>
    <meta name="description" content="{$site_info.site_seo_description|default=''}">
    <include file="public@head"/>
    <hook name="before_head_end"/>
</head>
<!-- HTML5 shim for IE8 support of HTML5 elements -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<![endif]-->


<link href="/themes/admin_simpleboot3/public/assets/themes/{:cmf_get_admin_style()}/bootstrap.min.css" rel="stylesheet">
<link href="/themes/admin_simpleboot3/public/assets/simpleboot3/css/simplebootadmin.css" rel="stylesheet">
<link href="__STATIC__/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
<!--[if lt IE 9]>
<script src="https://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->

<body class="page-index">
<div class="container" style="width: 100%">
    <include file="public@nav"/>

    <div class="contents apply applyZcXq">
        <div class="blockSty">
            <div class="applyTitle">
                <div class="zcTitle">志愿者注册——详细信息</div>
            </div>
            <div class="zcContent">
                <!--<form class="layui-form" action="{:url('portal/index/save_info')}" method="post">-->
                <form class="layui-form" id="form">
                    <div class="formLeft">
                        <div class="layui-form-item">
                            <label class="layui-form-label widthSty">用户姓名:<br></label>
                            <div class="layui-input-block">
                                <input type="text" name="user_nickname" required  lay-verify="required" placeholder="请输入用户名" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label widthSty">身份证号:<br></label>
                            <div class="layui-input-block">
                                <input type="text" id="idcard" name="more[idcard]" required  lay-verify="required" placeholder="请输入身份证号" autocomplete="off" class="layui-input">
                            </div>
                        </div>

                        <!--<div class="layui-form-item">-->
                            <!--<label class="layui-form-label">性别:</label>-->
                            <!--<div class="layui-input-block">-->
                                <!--男-->
                            <!--</div>-->
                        <!--</div>-->
                        <!--<div class="layui-form-item">-->
                            <!--<label class="layui-form-label widthSty">出生日期:<br></label>-->
                            <!--<div class="layui-input-block">-->
                                <!--1993-05-13-->
                            <!--</div>-->
                        <!--</div>-->
                        <!--<div class="layui-form-item">-->
                            <!--<label class="layui-form-label">社区:</label>-->
                            <!--<div class="layui-input-inline">-->

                            <!--</div>-->
                        <!--</div>-->

                        <div class="layui-form-item">
                            <label class="layui-form-label">籍贯:</label>
                            <div class="layui-input-block">
                                <input type="text" name="more[native]" placeholder="请输入籍贯" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">政治面貌:</label>
                            <div class="layui-input-block">
                                <select name="more[politic]" lay-verify="required">
                                    <option></option>
                                    <option value="0">群众</option>
                                    <option value="1">团员</option>
                                    <option value="2">党员</option>
                                </select>
                            </div>
                        </div>
                        <div class="layui-form-item">
                        <label class="layui-form-label">固定电话:</label>
                        <div class="layui-input-block">
                        <input type="text" name="more[phone]"   placeholder="请输入您的固定电话" autocomplete="off" class="layui-input">
                        </div>
                        </div>
                        <div class="layui-form-item">
                        <label class="layui-form-label">移动电话:</label>
                        <div class="layui-input-block">
                        <input type="text" name="more[mobile]" required  lay-verify="required" placeholder="请输入您的移动电话" autocomplete="off" class="layui-input">
                        </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">现住址:</label>
                            <div class="layui-input-block">
                                <input type="text" name="more[address]" value="{$more.address|default=''}"  placeholder="请输入您的现住址" autocomplete="off" class="layui-input">
                            </div>
                        </div>


                        <!--<div class="layui-form-item">-->
                            <!--<label class="layui-form-label">团体(选填):</label>-->
                            <!--<div class="layui-input-block">-->
                                <!--<select name="group" >-->
                                    <!--<option value="{$user.gorup|default=''}">{$user.groups.name|default='选择团体'}</option>-->
                                    <!--<foreach name="group" id="vo">-->

                                        <!--<option value="{$vo.id}">{$vo.name}</option>-->
                                    <!--</foreach>-->
                                <!--</select>-->
                            <!--</div>-->
                        <!--</div>-->

                        <div class="layui-form-item">
                            <label class="layui-form-label">工作单位:</label>
                            <div class="layui-input-block">
                                <input type="text" name="more[company]"   placeholder="请输入你的工作单位" autocomplete="off" class="layui-input">
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">职业:</label>
                            <div class="layui-input-block">
                                <select name="more[work]" >
                                    <option></option>
                                    <option value="保密">保密</option>
                                    <option value="金融">农村农业</option>
                                    <option value="生产加工">生产加工</option>
                                    <option value="制造">制造</option>
                                    <option value="服务娱乐">服务娱乐</option>
                                    <option value="政治">政治</option>
                                    <option value="科研教育">科研教育</option>
                                    <option value="管理">管理</option>
                                    <option value="商业">商业</option>
                                    <option value="其他">其他</option>
                                </select>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">文化程度:</label>
                            <div class="layui-input-block">
                                <select name="more[educate]" >
                                    <option></option>
                                    <option value="小学">小学</option>
                                    <option value="初中">初中</option>
                                    <option value="高中">高中</option>
                                    <option value="大专">大专</option>
                                    <option value="本科">本科</option>
                                    <option value="硕士">硕士</option>
                                    <option value="博士">博士</option>
                                </select>
                            </div>
                        </div>
                        <div class="layui-form-item layui-form-text">
                        <label class="layui-form-label">工作学习经历:</label>
                        <div class="layui-input-block">
                        <textarea name="more[experience]" placeholder="请输入您的工作学习经历" class="layui-textarea"></textarea>
                        </div>
                        </div>
                        <div class="layui-form-item layui-form-text">
                            <label class="layui-form-label">爱好及特长:</label>
                            <div class="layui-input-block">
                                <textarea name="more[hobby]" placeholder="请输入您的爱好及特长" class="layui-textarea"></textarea>
                            </div>
                        </div>
                        <!--<div class="layui-form-item layui-form-text">-->
                            <!--<label class="layui-form-label">补充信息:</label>-->
                            <!--<div class="layui-input-block">-->
                                <!--<textarea name="more[extra]" placeholder="请输入补充信息" class="layui-textarea"></textarea>-->
                            <!--</div>-->
                        <!--</div>-->

                        <div class="layui-form-item layui-form-text">
                            <label class="layui-form-label"> 志愿服务岗位：（任选1--2项）</label>
                            <div class="layui-input-block">
                                <foreach name="volunt_post" id="vo">
                                <input type="checkbox" name="post[{$vo.id}]" lay-skin="primary" title=" {$vo.name}">
                                </foreach>

                            </div>
                        </div>


                        <div class="layui-form-item">
                            <label class="layui-form-label">所属大队:</label>
                            <div class="layui-input-block">
                                <select name="big_team" lay-filter="big_team" lay-verify="required" id="big_team">
                                    <option value=""></option>
                                </select>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">所属中队:</label>
                            <div class="layui-input-block">
                                <select name="mid_team" lay-verify="required" id="mid_team">
                                    <option value=""></option>
                                </select>
                            </div>
                        </div>

                        <input type="hidden" name="avatar" id="img" value="{$user.avatar|default='/html/img/logoTx.png'}">

                        <div class="layui-form-item">
                            <div class="layui-input-block">
                                <button type="button" class="layui-btn Btn">提交个人信息</button>
                                <!--<button type="reset" class="layui-btn btnWidth ordBtn">下载个人档案</button>-->

                            </div>
                        </div>
                    </div>
                    <div class="formRight">

                        <a href="javascript:;" class="" id="test1">
                            <img src="/html/img/logoTx.png" id="pic"
                                 width="135" style="cursor: pointer"/>
                            (点击更换头像)
                        </a>
                    </div>
                    <div style="clear: both;"></div>
                </form>
            </div>
        </div>

    </div>


    <include file="public@footer"/>
    <!-- /container -->
    <include file="public@scripts"/>
    <script>
    </script>
    <hook name="before_body_end"/>

</body>
<div id="tanchu" style="display: none;">
    <foreach name="img" id="vo">
    <img src="{:cmf_get_image_url($vo.image)}" style="width: 240px" class="jfdhImg">
  </foreach>
    <!--<div class="tishiCon"></div>-->
    <!--<div class="jfdhBtn">-->
        <!--<button class="dhBtn" value="1">-->
            <!--<img src="/html/img/qudingDh.png" class="dhSty">-->
        <!--</button>-->
        <!--<div class="qxBtn">-->
            <!--<img src="/html/img/quxiaoDh.png" class="dhSty">-->
        <!--</div>-->
        <!--<div style="clear: both;"></div>-->
    <!--</div>-->
</div>

<script>
    $(".jfd").on('click',function (e) {
        //示范一个公告层
        tc=layer.open({
            type: 1
            ,title: false //不显示标题栏
            ,closeBtn: true
            ,area: '500px'
            ,shade: 0.3
            ,id: 'LAY_layuipro' //设定一个id，防止重复弹出
            ,moveType: 1 //拖拽模式，0或者1
            ,content:  $('#tanchu')
            ,success: function(layero){

            }
        });
    });

    layui.use(['form','layer','jquery'],function(){
        var form = layui.form,
                layer = parent.layer === undefined ? layui.layer : parent.layer,
                $ = layui.jquery;
        $( '#idcard').blur( function(e){
            var idcard=$( '#idcard').val()
            $.ajax({
                type: "post",
                url: "/portal/index/check_idcard",
                data:{"idcard":idcard},
                dataType: "json",
                success: function(res) {
                    layer.msg(res)
                    console.log(res)
                }
            });
        })

        var provinceText = "";
        var cityText = "";
        var areaText = "";
        //异步加载下拉框数据
        $.ajax({
            type: "post",
            url: "/portal/index/get_big_team",
            dataType: "json",
            success: function(res) {
                $html=''
                $.each(res, function (index, item) {
                    $html += "<option value='" + item.id + "'>" + item.name + "</option>";
                });
                $("#big_team").append($html);
                //append后必须从新渲染
                form.render('select');
            }
        });

        //监听省下拉框
        form.on('select(big_team)', function(dataObj){
            console.log(1)
            //移除城市下拉框所有选项
            $("#mid_team").empty();
            var cityHtml = '<option value="">请选择中队</option>';
            $("#mid_team").html(cityHtml);
            provinceText = $("#big_team").find("option:selected").text();
            var value = $("#big_team").val();
            console.log(value)
            //异步加载下拉框数据

            $.ajax({
                type: "post",
                url: "/portal/index/get_mid_team",
                data:{"id":value},
                dataType: "json",
                success: function(res) {
                    $html=''
                    var $html = "";
                    $.each(res, function (index, item) {
                        $html += "<option value='" + item.id + "'>" + item.name + "</option>";
                    });
                    $("#mid_team").append($html);
                    //append后必须从新渲染
                    form.render('select');
                }
            });
        });

    });


    layui.use('upload', function(){
        var upload = layui.upload;

        //执行实例
        var uploadInst = upload.render({
            elem: '#test1' //绑定元素
            ,url: '/portal/index/up_picture' //上传接口
            ,done: function(res){
                console.log(res.url);
                $("#img").val(res.url);
                $('#pic').attr('src',res.url);
                //上传完毕回调
            }
            ,error: function(){
                //请求异常回调
            }
        });


    });

    var bootstrapDateTimeInput = $("#datetime");
    if (bootstrapDateTimeInput.length) {
        Wind.css('bootstrapDatetimePicker');
        Wind.use('bootstrapDatetimePicker', function () {
            bootstrapDateTimeInput.datetimepicker({
                minView: "month", //选择日期后，不会再跳转去选择时分秒
                language:  'zh-CN',
                format: 'yyyy-mm-dd',
                todayBtn:  1,
                autoclose: 1,
            });
        });
    }
    layui.use(['form','layer'], function(){
        var form = layui.form
                ,layer = layui.layer;


         //报名成功
        $(".Btn").click(function () {
            var data=$('#form').serialize()
            console.log(data)
            $.ajax({
                type: "post",
                url: "/portal/index/save_info",
                data: data,
                dataType: "json",
                success: function(res) {
                    console.log(res)
                    layer.msg(res.msg)
                    if(!res.error){
                        setTimeout(function(){ window.location.href = '/'; }, 2000);
                    }
                }
            });

        })
    });
</script>
</html>

